# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor : Martin Wimpress <code@flexion.org>

pkgname=gufw
pkgver=22.04
pkgrel=2
pkgdesc='Uncomplicated way to manage your Linux firewall'
url='https://gufw.org/'
arch=('any')
license=('GPL3')
depends=('gtk3' 'polkit' 'python' 'python-gobject' 'ufw' 'webkit2gtk'
         'desktop-file-utils' 'gtk-update-icon-cache')
makedepends=('intltool' 'python-distutils-extra')
source=(https://github.com/costales/gufw/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('afddcf8c262666b82e93b9248d30426d86700ba9acbd43fd0dec8b77ccd9d0743ee18259be78c02d8c78300a853c50cfc5ba10a273cf30987744a33ae4920701')
b2sums=('069ab44211c029ff2c646d4eceb6dc06c62f71db3b0ff0a8e0df459f1070e5b554278ad25d191d71c4059f1a808925a871b03a37affea6f8c230caf878da854c')

prepare () {
  cd ${pkgname}-${pkgver}
  local PYTHONVERSION="$(python -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')"
  sed 's|/usr/share/gufw/gufw/gufw.py $1|/usr/lib/python'"${PYTHONVERSION}"'/site-packages/gufw/gufw.py "$@"|' -i bin/gufw-pkexec
}

build() {
  cd ${pkgname}-${pkgver}
  python setup.py build
}

package() {
  cd ${pkgname}-${pkgver}
  # required so desktop, icon and translation files get installed
  export XDG_RUNTIME_DIR="$(mktemp -d --tmpdir gufw-build-XXXXXXXXX)"
  python setup.py install --prefix=/usr --root="${pkgdir}" -O1
}

# vim: ts=2 sw=2 et:
